<?php

namespace App\Trip\Plane\Interfaces;

use App\Models\Plane\PlaneOrders\PlaneOrder;
use App\Models\Plane\PlaneOrders\PlaneOrderReturnApply;
use App\Trip\Plane\Interfaces\Result\BookResultInterface;
use App\Trip\Plane\Interfaces\Result\ChangeApplyResultInterface;
use App\Trip\Plane\Interfaces\Result\ChangeDetailInterface;
use App\Trip\Plane\Interfaces\Result\ChangePayCancelResultInterface;
use App\Trip\Plane\Interfaces\Result\ChangePayResultInterface;
use App\Trip\Plane\Interfaces\Result\OrderPayResultInterface;
use App\Trip\Plane\Interfaces\Result\PayCheckResultInterface;
use App\Trip\Plane\Interfaces\Result\PlaneOrderDetailInterface;
use App\Trip\Plane\Interfaces\Result\TicketReturnApplyResultInterface;
use App\Trip\Plane\Interfaces\Result\TicketReturnDetailInterface;
use App\Trip\Plane\Requests\BeforeBookRequest;
use App\Trip\Plane\Resp\BeforeBookResponse;

interface PlaneOrderInterface
{
    /**
     * 下单前
     * @param BeforeBookRequest $request
     * @return BeforeBookResponse
     */
    public function before_book(BeforeBookRequest $request): BeforeBookResponse;

    /**
     * 下单
     * @param PlaneOrder $order
     * @param array      $param
     * @return BookResultInterface
     */
    public function book(PlaneOrder $order, array $param): BookResultInterface;

    /**
     * 订单支付
     * @param PlaneOrder $order
     * @return OrderPayResultInterface
     */
    public function book_pay(PlaneOrder $order): OrderPayResultInterface;

    /**
     * 支付前校验
     * @param array $param
     * @return PayCheckResultInterface
     */
    public function before_pay_validate(array $param): PayCheckResultInterface;

    /**
     * 订单变更申请
     * @return mixed
     */
    public function change_apply(PlaneOrder $order_info): ChangeApplyResultInterface;

    /**
     * 可变更的航班查询
     * @param PlaneOrder $order_info 要改签的订单
     * @param string     $change_date 变更日期
     * @param array      $passengers 变更的乘客
     * @return mixed
     */
    public function before_change_flights(PlaneOrder $order_info, string $change_date, array $passengers): array;

    /**
     * 变更支付
     * @return mixed
     */
    public function change_pay(PlaneOrder $order_info, array $data): ChangePayResultInterface;

    /**
     * 变更支付取消
     * @return mixed
     */
    public function change_pay_cancel(PlaneOrder $order_info): ChangePayCancelResultInterface;

    /**
     * 退票前原因查询
     * @return mixed
     */
    public function before_refund_reasons(PlaneOrder $order_info, $passengers): string;

    /**
     * 退票申请
     * @return mixed
     */
    public function refund_apply(PlaneOrder $order_info, PlaneOrderReturnApply $return_info, $passengers): TicketReturnApplyResultInterface;

    /**
     * 订单详情
     * @param PlaneOrder $order_info
     * @return PlaneOrderDetailInterface
     */
    public function order_detail(PlaneOrder $order_info): PlaneOrderDetailInterface;


    /**
     * 变更详情查询
     * @param PlaneOrder $order_info
     * @return ChangeDetailInterface
     */
    public function change_detail(PlaneOrder $order_info): ChangeDetailInterface;

    /**
     * 退票详情查询
     * @param PlaneOrder            $order_info
     * @param PlaneOrderReturnApply $return_info
     * @return TicketReturnDetailInterface
     */
    public function refund_detail(PlaneOrder $order_info, PlaneOrderReturnApply $return_info): TicketReturnDetailInterface;

    /**
     * 订单相关的通知
     * @param string $business
     * @param array  $callback
     * @return mixed
     */
    public function notify(string $business, array $callback);
}